package com.yegs.jltqc.serviceImpl;

import com.yegs.jltqc.TO.NamePageQuery;
import com.yegs.jltqc.VO.BaseMenu;
import com.yegs.jltqc.VO.Version;
import com.yegs.jltqc.common.StoreException;
import com.yegs.jltqc.dao.BaseMenuRepository;
import com.yegs.jltqc.dao.VersionRepository;
import com.yegs.jltqc.service.BaseMenuService;
import com.yegs.jltqc.service.VersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VersionServiceImpl implements VersionService {

    @Autowired
    private VersionRepository versionRepository;

    @Override
    public void save(Version version) throws StoreException{
        versionRepository.save(version);
    }

    @Override
    public List<Version> list() {
        return versionRepository.findAll();
    }

    @Override
    public Version getNext(Long id) {
        return versionRepository.findFirstByVersionAfterOrderByIdDesc(id);
    }
}


